package com.fengxing.ams.web.facade;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Sort;

import com.fengxing.ams.web.facade.intf.IMenuFacade;
import com.fengxing.ams.web.facade.mouble.user.IMenuDao;
import com.fengxing.ams.web.facade.mouble.user.MenuVO;

@Component
@Transactional
public class MenuFacade extends BaseFacade implements IMenuFacade {
	@Autowired
	private IMenuDao menuDao;

	@Transactional(readOnly = true)
	@Override
	public List<MenuVO> findAllMenu() {
		return (List<MenuVO>) menuDao.findAll(new Sort(Sort.Direction.ASC, "sort"));
	}

	@Override
	public List<MenuVO> getMenuByUserId(Long userId) {
		return menuDao.findByUserId(userId);
	}
	
	@Transactional(readOnly = true)
	@Override
	public MenuVO getMenu(Long menuId) {
		return menuDao.findOne(menuId);
	}

	@Override
	public MenuVO saveMenu(MenuVO menu) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void deleteMenu(Long menuId) {
		// TODO Auto-generated method stub
		
	}
}
